<template>
	<view class="my-service" :style="myStyle">
		<view class="main">
			<u-avatar :src="img" size="150" mode="square"></u-avatar>
			<view class="right">
				<view class="title u-line-1">{{title}}</view>
				<view class="u-line-1">
					<text class="price margin-right-xl">{{price<0?'价格商议':('￥'+price + (unit?'/'+unit:'') + (exact?'':' 起'))}}</text>
					<text class="price margin-right-xs">{{rate}}</text>
					<text v-if="rate">评分</text>
				</view>

				<view class="tags u-line-1" v-if="tags.length">
					<u-tag class="tag" text="自营" size="mini" mode="plain" v-if="self" bg-color="#EEBC80" border-color="#EEBC80" color="#fff"></u-tag>
					<u-tag class="tag" v-for="j in tags" :text="j" :key="j" size="mini" mode="plain"></u-tag>
				</view>
			</view>
		</view>

		<view class="mid">
			<slot name="mid"></slot>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			bgColor: {
				type: String,
				default: '#fff'
			},
			img: {
				type: String,
				default: ''
			},
			title: {
				type: String,
				default: ''
			},
			price: {
				type: String,
				default: ''
			},
			exact: {
				type: Number,
				default: 0
			},
			rate: {
				type: String,
				default: ''
			},
			unit: {
				type: String,
				default: ''
			},
			subTitle: {
				type: String,
				default: ''
			},
			self: {
				type: Number,
				default: 0
			},
			tags: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				myStyle: {
					background: this.bgColor
				}
			};
		}
	}
</script>

<style lang="scss">
	.my-service {
		width: 670rpx;
		background: rgba(255, 255, 255, 1);
		border-radius: 8rpx;
		margin: 24rpx auto;
		padding: 16rpx;

		.main {
			padding: 0 0 16rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.right {
				width: 460rpx;
				height: 150rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				font-size: 24rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				line-height: 40rpx;

				.title {
					font-weight: bold;
					font-size: 28rpx;
					height: 50rpx;
					line-height: 50rpx;
					color: rgba(51, 51, 51, 1);
				}

				.price {
					font-weight: 600;
					height: 50rpx;
					line-height: 50rpx;
					color: rgba(255, 139, 86, 1);
				}

				.tags {
					height: 50rpx;
					display: flex;
					align-items: center;

					.tag {
						margin-right: 12rpx;
					}
				}
			}
		}
	}
</style>
